﻿using System;
using System.Globalization;

namespace Besture.Common.Helper
{
    public class DateTimeHelper
    {

        /// <summary>
        /// 标准格式化(2014-01-01)
        /// </summary>
        /// <returns></returns>
        public static string FormatStandard()
        {
            return DateTime.Now.ToString("yyyy-MM-dd");
        }

        /// <summary>
        /// 标准格式化(2014-01-01)
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public static string FormatStandard(DateTime time)
        {
            return time.ToString("yyyy-MM-dd");
        }


        /// <summary>
        /// 中文格式化(2014年01月01日)
        /// </summary>
        /// <returns></returns>
        public static string FormatCn()
        {
            return DateTime.Now.ToString("yyyy年MM月dd");
        }


        /// <summary>
        /// 中文格式化(2014年01月01日)
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public static string FormatCn(DateTime time)
        {
            return time.ToString("yyyy年MM月dd");
        }

        /// <summary>
        /// 获取时间戳
        /// </summary>
        /// <returns></returns>
        public static string GetTimestamp()
        {
            return DateTime.Now.ToString("yyyyMMddHHmmssffff", DateTimeFormatInfo.InvariantInfo);
        }
    }
}
